package cn.elite.sqlSession;

import java.sql.SQLException;
import java.util.List;

/**
 * @Author: ZLY
 * @Date: 2020/10/6 16:40
 * @Description:
 */
public interface SqlSession {
    /**
     * 新增
     * @param statementId
     * @param params
     * @return
     */
    int insert(String statementId, Object... params) throws Exception;

    /**
     * 修改
     * @param statementId
     * @param params
     * @return
     */
    int update(String statementId, Object... params) throws SQLException, Exception;

    /**
     * 删除
     * @param statementId
     * @param params
     * @return
     */
    int delete(String statementId, Object... params) throws SQLException, Exception;
    /**
     * 查询所有
     * @param statementId
     * @param params
     * @param <E>
     * @return
     */
    <E> List<E> selectList(String statementId,Object...params) throws Exception;

    /**
     * 查询一条
     * @param statementId
     * @param params
     * @param <T>
     * @return
     */
    <T> T selectOne(String statementId,Object...params) throws Exception;

    /**
     * 获取代理对象
     * @param mapperClass
     * @param <T>
     * @return
     * @throws Exception
     */
    <T> T getMapper(Class<?> mapperClass) throws Exception;
}
